<%@ page import="com.library.entity.po.BookRankPO" %>
<%@ page import="java.util.Set" %>
<%@ page import="com.library.entity.Student" %>
<%@ page import="com.library.entity.po.StudentRankPO" %>
<%@ page import="com.library.entity.Admin" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>图书管理系统</title>
    <style>
        /* 页面整体样式 */
        body {
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
        }

        /* 顶部导航栏样式 */
        .header {
            background-color: #f8f9fa;
            padding: 10px 20px;
            border-bottom: 1px solid #e0e0e0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .header h1 {
            margin: 0;
            font-size: 20px;
            color: #333;
        }

        .user-info {
            display: flex;
            align-items: center;
        }

        .logout-btn {
            margin-left: 15px;
            padding: 5px 10px;
            background-color: #f8f9fa;
            border: 1px solid #ddd;
            border-radius: 4px;
            cursor: pointer;
            text-decoration: none;
            color: #333;
        }

        /* 左侧导航栏样式 */
        .nav-container {
            width: 200px;
            background-color: #f8f9fa;
            float: left;
            min-height: calc(100vh - 50px);
            border-right: 1px solid #e0e0e0;
        }

        .admin-label {
            padding: 15px;
            background-color: #e9ecef;
            font-weight: bold;
            border-bottom: 1px solid #ddd;
        }

        .nav-container ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        .nav-container li {
            padding: 15px;
            cursor: pointer;
            border-bottom: 1px solid #e0e0e0;
        }

        .nav-container li:hover {
            background-color: #e9ecef;
        }

        .nav-container li a {
            text-decoration: none;
            color: #333;
            display: block;
        }

        .nav-container li.active {
            background-color: #007bff;
        }

        .nav-container li.active a {
            color: white;
        }

        /* 中间内容区域样式 */
        .content-container {
            margin-left: 200px;
            padding: 20px;
        }

        .welcome-message {
            margin-bottom: 30px;
        }

        /* 排行榜样式 */
        .ranking {
            margin-bottom: 30px;
            background-color: white;
            padding: 15px;
            border-radius: 5px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

        .ranking h3 {
            margin-top: 0;
            margin-bottom: 15px;
            color: #333;
            border-bottom: 1px solid #eee;
            padding-bottom: 10px;
        }

        .ranking ul {
            list-style: none;
            padding: 0;
        }

        .ranking li {
            padding: 8px 0;
            border-bottom: 1px dashed #eee;
        }

        .ranking li:last-child {
            border-bottom: none;
        }
    </style>
</head>
<body>
<!-- 顶部导航栏 -->
<div class="header">
    <h1>图书管理系统</h1>
    <div class="user-info">
        欢迎您，<%=((Admin) request.getSession().getAttribute("admin")).getUsername()%>
        <a href="../common?method=logout" class="logout-btn">退出登录</a>
    </div>
</div>

<!-- 左侧导航栏 -->
<div class="nav-container">
    <div class="admin-label">管理端</div>
    <ul>
        <li class="active"><a href="../admin?method=adminIndex">首页</a></li>
        <li><a href="../admin/book?method=bookManage">书籍</a></li>
        <li><a href="../admin/bookcopy?method=bookCopyManage">书籍副本</a></li>
        <li><a href="../admin/payrec?method=fineRecord">学生罚款记录</a></li>
    </ul>
</div>

<!-- 中间内容区域 -->
<div class="content-container">
    <div class="welcome-message">
        <h2>欢迎使用图书管理系统</h2>
    </div>

    <!-- 书籍借阅量排行榜 -->
    <div class="ranking">
        <h3>书籍借阅量排行榜</h3>
        <ul>
            <% Set<BookRankPO> bookRank = (Set<BookRankPO>) request.getAttribute("bookRank");
                int i = 1;
                for (BookRankPO book : bookRank) {%>
            <li><%=i%>. 书名：《<%=book.getBname()%>》 - 借阅量：<%=book.getCount()%>
            </li>
            <% if (++i > 5) {
                break;
            }
            }%>
        </ul>
    </div>

    <!-- 学生借阅活跃度排行榜 -->
    <div class="ranking">
        <h3>学生借阅活跃度排行榜</h3>
        <ul>
            <% Set<StudentRankPO> studentRank = (Set<StudentRankPO>) request.getAttribute("studentRank");
                i = 1;
                for (StudentRankPO student : studentRank) {%>
            <li><%=i%>. 学号：<%=student.getSno()%> - 姓名：<%=student.getUsername()%> - 借阅次数：<%=student.getCount()%>
            </li>
            <% if (++i > 5) {
                break;
            }
            }%>
        </ul>
    </div>
</div>
</body>
</html>
